


import os
from openai import OpenAI

os.environ["DASHSCOPE_API_KEY"] = 'sk-965dc39b016c49ecbe29de180f4db2b6'

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"), # 如何获取API Key：https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key
    base_url="https://dashscope.aliyuncs.com/compatible-mode/v1"
)


# completion = client.chat.completions.create(
#     model="qwen-plus", # 模型列表：https://help.aliyun.com/zh/model-studio/getting-started/models
#     messages=[{"role": "user", "content": "周恩来？"}]
# )
# print(completion.choices[0].message.content)